//
//  CycleDetailViewController.m
//  TextApplication
//
//  Created by dllo on 16/9/7.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "CycleDetailViewController.h"
#import "TextView.h"
//#import "UMSocialData.h"
//#import "UMSocialSnsService.h"
//#import "UMSocial.h"
//#import "UMSocialSnsData.h"


@interface CycleDetailViewController ()
@end

@implementation CycleDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor colorWithWhite:0.094 alpha:1.000];
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithWhite:0.165 alpha:1.000];
    self.title = @"良仓杂志";
    
    UIButton *left = [TextView createButtonWithImage:[UIImage imageNamed:@"10"]];
    [left addTarget:self action:@selector(backClick:) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:left];
    
    
    UIButton *secButton = [TextView createButtonWithImage:[UIImage imageNamed:@"31"]];
    [secButton addTarget:self action:@selector(shareClick:) forControlEvents:UIControlEventTouchUpInside];

    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:secButton];
    
    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
    webView.backgroundColor = [UIColor colorWithWhite:0.094 alpha:1.000];
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@", self.urlStr]]];
    NSLog(@"%@", self.urlStr);
    [self.view addSubview:webView];
    [webView loadRequest:request];
    
}
- (void)shareClick:(UIButton *)button {
    //    NSLog(@"怎么回事儿");
    NSURL *url = [NSURL URLWithString:self.urlStr];
    NSString *string = [NSString stringWithFormat:@"%@", url];
    //    [UMSocialSnsService presentSnsIconSheetView:self
    //                                        appKey:@"57e3a228e0f55ace8d003d06"
    //                                      shareText:string
    //                                     shareImage:[UIImage imageNamed:@"icon.png"]
    //                                shareToSnsNames:[NSArray arrayWithObjects:UMShareToTencent,UMShareToRenren,UMShareToSina,UMShareToQzone,UMShareToEmail,UMShareToFacebook,UMShareToDouban,UMShareToSms,UMShareToQQ,nil]
    //                                       delegate:nil];
    
    //    [UMSocialData defaultData].extConfig.title = @"分享的title";
    //    [UMSocialData defaultData].extConfig.wechatSessionData.url = @"http://baidu.com";
    // 记住这里填写的是友盟的appKey
//    [UMSocialSnsService presentSnsIconSheetView:self
//                                         appKey:@"57e3a228e0f55ace8d003d06"
//                                      shareText:string
//                                     shareImage:[UIImage imageNamed:@"icon"]
//                                shareToSnsNames:@[UMShareToWechatSession,UMShareToWechatTimeline,UMShareToSina,UMShareToQQ,UMShareToQzone]
//                                       delegate:nil];
    
}

- (void)backClick:(UIButton *)button {
    [self.navigationController popToRootViewControllerAnimated:NO];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
